package org.aeon.client.view.components.listColumn;

import lombok.Getter;
import org.aeon.client.view.components.sessionPanel.SessionPanel;

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 * @author: MissingAeon
 * @date: 2024/2/20 12:58
 * @description:
 */
@Getter
public class ListColumnPanel extends JPanel {
    private final MessageListPanel messageListPanel;
    private final ContactListPanel contactListPanel;
    private final SearchListPanel searchListPanel;

    public ListColumnPanel(SessionPanel sessionPanel) {
        this.setPreferredSize(new Dimension(300, 700));
        final CardLayout layout = new CardLayout();
        this.setLayout(layout);
        messageListPanel = new MessageListPanel(sessionPanel);
        this.add("MLP", messageListPanel);
        contactListPanel = new ContactListPanel(sessionPanel);
        this.add("CLP", contactListPanel);
        searchListPanel = new SearchListPanel(sessionPanel);
        this.add("SLP", searchListPanel);

        this.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                ListColumnPanel.this.requestFocus();
            }
        });
    }
}
